<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>生活Plus-App下载</title>

<!--bootstrap框架文件加载-->
<link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<!--二维码生成jquery文件加载-->
<script type="text/javascript" src="http://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>  
<script type="text/javascript" src="http://cdn.staticfile.org/jquery.qrcode/1.0/jquery.qrcode.min.js"></script>
<!-- 查询手机系统文件加载-->
<script src="http://cdnjs.cloudflare.com/ajax/libs/mobile-detect/1.4.1/mobile-detect.min.js"></script>
	
	<style>
		.boxCenter{
	text-align: center;
    background-color: #fff;
    border-radius: 20px;
    width: auto;
    height: auto;
    position: absolute;
    left: 50%;
    top: 50%; 
    transform: translate(-50%,-50%);
		}
	</style>
</head>

<body>
	<div id="box" class="boxCenter col-lg-12 col-md-12 col-sm-12 col-xs-12">
		<div id="qrcode" style="display: none"></div>
		
		<div id="imgDiv"></div>
		<script type="text/javascript">
			
System();
			
			
//		$("#qrcode").qrcode("xxx");
			
	
			
//		Array.prototype.contains = function(needle) {  
//        for (i in this) {  
//            if (this[i].indexOf(needle) > 0)  
//                return i;  
//        }  
//        return -1;  
//    }  
			
			//test
			
		function System(){
			var appStore = "https://itunes.apple.com/cn/app/%E7%"
							+"94%9F%E6%B4%BBplus-%E9%AB%98%E5%93%81%"
							+"E8%B4%A8%E9%AB%98%E4%BC%98%E6%83%A0%"
							+"E7%89%B9%E8%89%B2%E6%9C%8D%E5%8A%"
						    +"A1/id1338400465?mt=8";
			
			var yingyongbao = "http://a.app.qq.com/o/simple.jsp?pkgname=com.yiqi.hj";
			var device_type = navigator.userAgent;//获取userAgent信息  
    		var md = new MobileDetect(device_type);//初始化mobile-detect  
			document.write(device_type+"<br>");
    		var os = md.os();//获取系统  
			document.write(os+"<br>");
			
			if(os == "AndroidOS"){
				$("#qrcode").qrcode(yingyongbao);
			}else if(os == "IOS"){
					 $("#qrcode").qrcode("appStore");
					 }else{
						 $("#qrcode").qrcode("xxx");
					 }
			
			
			//从canvas中提取图片image
        function convertCanvasToImage(canvas) {
            //新Image对象，可以理解为DOM
            var image = new Image();
            // canvas.toDataURL 返回的是一串Base64编码的URL，当然,浏览器自己肯定支持
            // 指定格式PNG
            image.src = canvas.toDataURL("image/png");
            return image;
        }

        //获取网页中的canvas对象
        var mycanvas1=document.getElementsByTagName('canvas')[0];

        //将转换后的img标签插入到html中
        var img = convertCanvasToImage(mycanvas1);
        $('#imgDiv').append(img);//imgDiv表示你要插入的容器id
			
			}
	
	
//	var phone = md.phone();
//	document.write(phone+"<br>");
			
			
	</script>
		<p>扫描二维码下载</p>
	</div>
	
	
</body>
</html>
